﻿/*   
    Copyright (C) 2009 Galaktika Corporation ZAO

    This file is a part of Galaktika.BusinessMonitor
 
    Galaktika.BusinessMonitor is a free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
      
    You should have received a copy of the GNU General Public License
    along with Galaktika.BusinessMonitor.  If not, see <http://www.gnu.org/licenses/>.
  
    If GPL v.3 is not suitable for your products or company,
    Galaktika Corp provides Galaktika.BusinessMonitor under a flexible commercial license
    designed to meet your specific usage and distribution requirements.
    If you have already obtained a commercial license from Galaktika Corp,
    you can use this file under those license terms.
*/

using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace Galaktika.BI.Silverlight.Runtime.Data
{
    public class RelationalData : INotifyPropertyChanged
    {
        private string first;

        public string First
        {
            get { return first; }
            set { first = value;
            OnPropertyChanged("First");}
        }

        private int second;
        public int Second
        {
            get { return second; }
            set
            {
                second = value;
                OnPropertyChanged("Second");
            }
        }



        public static IEnumerable<RelationalData> TestData
        {
            get
            {
                var coll = new List<RelationalData>();
                coll.Add(new RelationalData() { first = "Brest", second = 430000 });
                coll.Add(new RelationalData() { first = "Vitebsk", second = 220000 });
                coll.Add(new RelationalData() { first = "Grodno", second = 470000 });
                coll.Add(new RelationalData() { first = "Gomel", second = 580000 });
                coll.Add(new RelationalData() { first = "Minsk", second = 1600000 });
                coll.Add(new RelationalData() { first = "Mogilev", second = 380000 });
                return coll;
            }
        }        

        #region INotifyPropertyChanged Members

        /// <summary>
        /// Implements the INotifyPropertyChanged interface.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Fires the PropertyChanged event.
        /// </summary>
        /// <param name="propertyName">Name of the property that changed.</param>
        private void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler.Invoke(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
